<?php
/**
 * Created by PhpStorm.
 * User: xiatong
 * Date: 2018/10/22
 * Time: 下午3:12
 */

namespace app\api\model;

use app\common\model\OrderVip as OrderVipModel;

class OrderVip extends OrderVipModel
{
    public function add($user_id,$recharge_id){
        //查询会员类型
        $recharge = \app\common\model\Recharge::get($recharge_id);
        //记录订单信息
        $this->save([
            'user_id' => $user_id,
            'order_no' => $this->orderNo(),
            'money' => $recharge['denomination'],
            'pressent' => $recharge['cash_back'],
            'wxapp_id' => self::$wxapp_id,
        ]);
        return true;
    }

//    根据订单查询orderVip记录
    /**
     * vip充值记录
     * @param $order_no
     * @return null|static
     * @throws \think\exception\DbException
     */
    public function payDetail($order_no)
    {
        return self::get(['order_no' => $order_no, 'pay_status' => 0]);
    }


}